import { defineComponent, reactive } from "vue";
import PageTitle from "@/components/PageTitle";
import ListView from "@/components/ListView";
import RowView from "@/components/RowView";
import ColView from "@/components/ColView";
import { Divider } from "vant";
import { getSize, getUserInfoUrl, phoneClick } from "@/command/apiTool";
import { IFilterMenuChoose } from "@/components/FilterMenu/types";
import RoundInfo from "@/components/RoundInfo";
import CardView from "@/components/CardView";
import TextView from "@/components/TextView";
import router from "@/router";
import { useRoute, useRouter } from "vue-router";
export default defineComponent({
  name: "",
  setup() {
    const route = useRoute();
    const data: IFilterMenuChoose[] = [
      { type: "area", key: "areaCode" },
      // { type: "productType", key: "categoryId" },
      // { type: "datePicker", key: "time" },
    ];
    const form = reactive({ keyWord: "" });
    const render2 = () => {
      return (
        <ListView
          {...getUserInfoUrl({
            dh: "",
            xh: "/api/H5/richMeansOfAgriculturalProduction/small/listByLargeId",
          })}
          type="list"
          itemHeight={106}
          renderItem={renderItem}
          class={"mt-[10px]"}
        />
      );
    };
    const renderItem = (e: any) => {
      const bottomLabel = () => {
        return (
          <ColView class={"w-[53vw]"}>
            <TextView>{e.name}</TextView>
            <TextView class={"!w-full break-words"}>{e.content}</TextView>
          </ColView>
        );
      };
      return (
        <CardView class="p-[10px]" radius={0}>
          <RowView class="justify-between">
            <RoundInfo
              src={e.path}
              title={e.userName}
              class="roundinfo-expert"
              v-slots={{ bottomLabel }}
              onClick={() => router.push(`/farmProductDetailXh?id=${e.id}`)}
            />
            <ColView class="items-center justify-center">
              <img
                src={"https://qfile.nongqibang.com/47141%402x.png"}
                class="!w-[44px] !h-[44px]"
                onClick={(e) => {
                  e.preventDefault();
                  e.stopPropagation();
                  router.push(`behalfBuyApplication?id=${route.query.id}`);
                }}
              />
            </ColView>
          </RowView>
        </CardView>
      );
    };
    return () => {
      return (
        <PageTitle title="大户使用农资" bgColor="white" childClass="!p-[0px]">
          {render2()}
        </PageTitle>
      );
    };
  },
});
